﻿using System;
using System.Collections.Generic;
using BIS.Portal.Core.Base;
using BIS.Portal.Core.Global;
using BIS.Portal.Modules.CMS.Entity;
using BIS.Portal.Modules.CMS.BO;

namespace BIS.Portal.Modules.CMS
{
    public partial class CmsFreeTextControl_Settings : ControlSettingBase
    {

        #region Load Data Settings
        
        public  string ArticleFreeText
        {
            get
            {
                return GetControlSetting<string>(ModuleSettingNames.CmsFreeText.ddlArticleFreeText,
                                                 PortalContext.LanguageAlias);
            }
        }
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            loaddata();
            ddlArticleFreeText.SelectedValue = ArticleFreeText;
        }
        private void loaddata()
        {
            IList<ClientCmsArticleFreeTextEntity> objFT =
                ClientCmsArticleBO.GetArticleFreeText(PortalContext.LanguageInUseId);
            ddlArticleFreeText.DataSource = objFT;
            ddlArticleFreeText.DataTextField = "ArticleTitle";
            ddlArticleFreeText.DataValueField = "ArticleId";
            ddlArticleFreeText.DataBind();
        }
        public override void SaveSettings(Dictionary<string, string> settings)
        {
            SetControlSettingForAllLanguages(ddlArticleFreeText.ID,ModuleSettingNames.CmsFreeText.ddlArticleFreeText,settings);
        }
    }
}